const Router = require('koa-router');

const {tokenValidator} = require('../middleware/auth.middleware');
const {gameFormValidator, idValidator} = require('../middleware/validate.middleware');
// 业务路由拆分 -- controller层
const {addGame, updateGame, queryGame, queryGameDetail, deleteGame} = require('../controller/game.controller');

// 统一前缀
const router = new Router({prefix: '/game'});

// 增删改查
router.post('/add', tokenValidator, gameFormValidator, addGame);
router.post('/update', tokenValidator, idValidator, gameFormValidator, updateGame);
router.get('/list', tokenValidator, queryGame);
router.get('/detail', tokenValidator, idValidator, queryGameDetail);
router.post('/delete', tokenValidator, idValidator, deleteGame);


module.exports = router;